package com.cskaoyan.Utils;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.session.Session;
import org.springframework.stereotype.Component;

/**
 * @author hsp
 * @date 2021/5/12 15:02
 */
@Component
public class MyUtils {


    public static Integer getUserId(){
        Integer userId = (Integer) SecurityUtils.getSubject().getSession().getAttribute("userId");

        return userId;
    }

    public static String getUsername(){
        String username = (String) SecurityUtils.getSubject().getSession().getAttribute("username");
        return username;
    }
    public static String getAdminname(){
        String username = (String) SecurityUtils.getSubject().getSession().getAttribute("adminName");
        return username;
    }

    public static Session getSession(){

        return SecurityUtils.getSubject().getSession();
    }

}
